-
-
Notifications
You must be signed in to change notification settings - Fork 32
build: migrate prettier config to typescript and remove eslint-plugin-prettier #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: migrate prettier config to typescript and remove eslint-plugin-prettier #540
Conversation
d107e8e
to
a84f50c
Compare
What I'm finding is that when we run on a version of node that doesn't include native type stripping (22.17.1), the eslint docs config that uses the prettier api directly can't load the
So, what I'm thinking I'll do, is put a separate PR to change all of the relative import paths to use What's especially interesting, is I wasn't able to reproduce the error locally (hence all of the test commits lol) Edit: I actually think it's more to do with #542 now. But it'll still be good to do the other change, to support native node type stripping. |
…-prettier This change moves from using `eslint-prettier-plugin` to using `eslint-config-prettier` and prettier directly for format checking. A result of us never running prettier on the root files, is that there were some adjustments needed. I ran prettier on the repo and have added those changes too. Lastly, I moved the config to `typescript`.
3fe4a5d
to
262946e
Compare
'plugin:unicorn/recommended', | ||
), | ||
pluginN.configs['flat/recommended'], | ||
prettier, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we technically want to include this last to ensure it overrides any incompatible config?
eslint.config.js (flat config): Import eslint-config-prettier, and put it in the configuration array – after other configs that you want to override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will generally put the prettier config after all of the reusable configs, but before any configs that I've created with overrides / additional rules. The idea being that anything I add myself is an intentional choice and should take precedence, which I think aligns with the spirit of that documentation. With that said, it's currently before the TS Configs, so I should at least move it to be after those (I authored this PR before adding the TS configs). Would you prefer I move it all the way to the end or just after the ts configs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your reasoning makes sense. I'll leave it up to you.
"lint": "npm-run-all --continue-on-error --aggregate-output --parallel lint:*", | ||
"lint:docs": "markdownlint \"**/*.md\"", | ||
"lint:eslint-docs": "npm-run-all -s build \"update:eslint-docs -- --check\"", | ||
"lint:js": "eslint --cache --ignore-pattern \"**/*.md\" .", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the path needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's optional. It defaults to current working directory. I can add it back, if you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to use default then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This change moves from using
eslint-prettier-plugin
to usingeslint-config-prettier
and prettier directly for format checking.A result of us never running prettier on the root files, is that there were some adjustments needed. I ran prettier on the repo and have added those changes too.
Lastly, I moved the config to
typescript
.